/**********************************************************************
 * Project : WoWGuildRoster (http://www.codeplex.com/WowGuildRoster/)
 * Module  : DotNetWarcraft.WoWGuildRoster.Business.Constants
 **********************************************************************
 * 
 * 
 * 
 **********************************************************************
 * License : All code is subject to licensing terms per the Microsoft
 *   Permissive License (Ms-PL) v1.1. For full license information,
 *   refer to the packaged license.txt file.
 **********************************************************************
 * Revision History:
 * -----------------
 * 2007-07-29 -- Cliff Simpkins: Initial Version
 * 2007-09-02 -- Cliff Simpkins: Added Roster rank defaults
 **********************************************************************
 */
using System;
using System.Data;
using System.Configuration;

namespace DotNetWarcraft.WoWGuildRoster.Business {
  public class WGRConstants {
    public const String DEFAULT_GUILD_NAME = "";
    public const String DEFAULT_SERVER_NAME = "";
    public const String DEFAULT_REGION_NAME = "US";
    //To Do: Needs to be localized
    public const String DEFAULT_GUILD_RANK_0 = "Guild Leader";
    public const String DEFAULT_GUILD_RANK_1 = "Guild Rank 1";
    public const String DEFAULT_GUILD_RANK_2 = "Guild Rank 2";
    public const String DEFAULT_GUILD_RANK_3 = "Guild Rank 3";
    public const String DEFAULT_GUILD_RANK_4 = "Guild Rank 4";
    public const String DEFAULT_GUILD_RANK_5 = "Guild Rank 5";
    public const String DEFAULT_GUILD_RANK_6 = "Guild Rank 6";
    public const String DEFAULT_GUILD_RANK_7 = "Guild Rank 7";
    public const String DEFAULT_GUILD_RANK_8 = "Guild Rank 8";
    public const String DEFAULT_GUILD_RANK_9 = "Guild Rank 9";
    public const String DEFAULT_GUILD_RANK_10 = "Guild Rank 10";


    #region "Constant Values and Functions - Warcraft Regions"
    protected const String WARCRAFT_REGION_EUROPE = "Europe";
    protected const String WARCRAFT_REGION_EUROPE_WWW = "eu.wowarmory.com";
    protected const String WARCRAFT_REGION_US = "US";
    protected const String WARCRAFT_REGION_US_WWW = "www.wowarmory.com";
    protected const String WARCRAFT_REGION_UNKNOWN = "Unknown";

    public static String WowRegion_String(WarcraftRegions wowRegion) {
      switch (wowRegion) {
        case WarcraftRegions.RegionEurope:
          return WARCRAFT_REGION_EUROPE;
        case WarcraftRegions.RegionUS:
          return WARCRAFT_REGION_US;
        default:
          return WARCRAFT_REGION_UNKNOWN;
      }
    }
    public static int WowRegion_Int(WarcraftRegions wowRegion) {
      switch (wowRegion) {
        case WarcraftRegions.RegionEurope:
          return 2;
        case WarcraftRegions.RegionUS:
          return 1;
        default:
          return 0;
      }
    }
    public static WarcraftRegions WowRegion_Enum(String wowRegion) {
      switch (wowRegion) {
        case WARCRAFT_REGION_EUROPE:
          return WarcraftRegions.RegionEurope;
        case WARCRAFT_REGION_US:
          return WarcraftRegions.RegionUS;
        default:
          return WarcraftRegions.RegionUnknown;
      }
    }
    public static WarcraftRegions WowRegion_Enum(int wowRegion) {
      switch (wowRegion) {
        case 1:
          return WarcraftRegions.RegionUS;
        case 2:
          return WarcraftRegions.RegionEurope;
        default:
          return WarcraftRegions.RegionUnknown;
      }
    }
    public static String ArmoryServer(WarcraftRegions wowRegion) {
      switch (wowRegion) {
        case WarcraftRegions.RegionUS:
          return WARCRAFT_REGION_US_WWW;
        case WarcraftRegions.RegionEurope:
          return WARCRAFT_REGION_EUROPE_WWW;
        default:
          return WARCRAFT_REGION_US_WWW;
      }
    }
    #endregion
    #region "Constant Values and Functions - Stat Types"
    public static int WowStatType_Int(WarcraftStatTypes wowStatType) {
      switch (wowStatType) {
        case WarcraftStatTypes.Ability:
          return 2;
        case WarcraftStatTypes.ArenaTeamInfo:
          return 15;
        case WarcraftStatTypes.ArmorSkill:
          return 6;
        case WarcraftStatTypes.BaseCharStats:
          return 16;
        case WarcraftStatTypes.CraftingSkill:
          return 5;
        case WarcraftStatTypes.DefenseSkill:
          return 10;
        case WarcraftStatTypes.GuildInfo:
          return 14;
        case WarcraftStatTypes.Languages:
          return 8;
        case WarcraftStatTypes.MeleeSkill:
          return 11;
        case WarcraftStatTypes.ProfessionSkill:
          return 3;
        case WarcraftStatTypes.RangedSkill:
          return 12;
        case WarcraftStatTypes.Reputation:
          return 1;
        case WarcraftStatTypes.Resistances:
          return 9;
        case WarcraftStatTypes.SecondarySkill:
          return 4;
        case WarcraftStatTypes.SpellSkill:
          return 13;
        case WarcraftStatTypes.WeaponSkill:
          return 7;
        default:
          return 0;
      }
    }
    public static WarcraftStatTypes WowStatType_Enum(int wowStatType) {
      switch (wowStatType) {
        case 1:
          return WarcraftStatTypes.Reputation;
        case 2:
          return WarcraftStatTypes.Ability;
        case 3:
          return WarcraftStatTypes.ProfessionSkill;
        case 4:
          return WarcraftStatTypes.SecondarySkill;
        case 5:
          return WarcraftStatTypes.CraftingSkill;
        case 6:
          return WarcraftStatTypes.ArmorSkill;
        case 7:
          return WarcraftStatTypes.WeaponSkill;
        case 8:
          return WarcraftStatTypes.Languages;
        case 9:
          return WarcraftStatTypes.Resistances;
        case 10:
          return WarcraftStatTypes.DefenseSkill;
        case 11:
          return WarcraftStatTypes.MeleeSkill;
        case 12:
          return WarcraftStatTypes.RangedSkill;
        case 13:
          return WarcraftStatTypes.SpellSkill;
        case 14:
          return WarcraftStatTypes.GuildInfo;
        case 15:
          return WarcraftStatTypes.ArenaTeamInfo;
        case 16:
          return WarcraftStatTypes.BaseCharStats;
        default:
          return WarcraftStatTypes.Unknown;
      }
    }

    public static int LoadType_Int(WGR_LoadTypes loadType) {
      switch (loadType) {
        case WGR_LoadTypes.RosterLoad:
          return 1;
        case WGR_LoadTypes.CharEntryLoad:
          return 2;
        default:
          return 0;
      }
    }
    public static String LoadType_String(WGR_LoadTypes loadType) {
      switch (loadType) {
        case WGR_LoadTypes.RosterLoad:
          return "Roster";
        case WGR_LoadTypes.CharEntryLoad:
          return "Characters";
        default:
          return "Unknown";
      }
    }
    public static WGR_LoadTypes LoadType_Enum(int loadType) {
      switch (loadType) {
        case 1:
          return WGR_LoadTypes.RosterLoad;
        case 2:
          return WGR_LoadTypes.CharEntryLoad;
        default:
          return WGR_LoadTypes.Unknown;
      }
    }

    public static int LoadStatus_Int(WGR_LoadStatus loadStatus) {
      switch (loadStatus) {
        case WGR_LoadStatus.NewOrEmpty:
          return 0;
        case WGR_LoadStatus.LoadedSuccessfully:
          return 1;
        case WGR_LoadStatus.ReloadRequired:
          return 2;
        case WGR_LoadStatus.LoadInProgress:
          return 3;
        default:
          return -1;
      }
    }
    public static String LoadStatus_String(WGR_LoadStatus loadStatus) {
      switch (loadStatus) {
        case WGR_LoadStatus.NewOrEmpty:
          return "New or Empty Entry";
        case WGR_LoadStatus.LoadedSuccessfully:
          return "Loaded Successfully";
        case WGR_LoadStatus.ReloadRequired:
          return "Reload Required";
        case WGR_LoadStatus.LoadInProgress:
          return "In Progress";
        default:
          return "Unknown";
      }
    }
    public static WGR_LoadStatus LoadStatus_Enum(int loadStatus) {
      switch (loadStatus) {
        case 0:
          return WGR_LoadStatus.NewOrEmpty;
        case 1:
          return WGR_LoadStatus.LoadedSuccessfully;
        case 2:
          return WGR_LoadStatus.ReloadRequired;
        case 3:
          return WGR_LoadStatus.LoadInProgress;
        default:
          return WGR_LoadStatus.Uninitialized;
      }
    }


    public static String ArmoryURL_CharInfo(WarcraftRegions wowRegion, String charName, String serverName) {
      return "http://" + ArmoryServer(wowRegion) + "/character-sheet.xml?r=" + serverName + "&n=" + charName;
    }
    public static String ArmoryURL_RepInfo(WarcraftRegions wowRegion, String charName, String serverName) {
      return "http://" + ArmoryServer(wowRegion) + "/character-reputation.xml?r=" + serverName + "&n=" + charName;
    }
    public static String ArmoryURL_SkillsInfo(WarcraftRegions wowRegion, String charName, String serverName) {
      return "http://" + ArmoryServer(wowRegion) + "/character-skills.xml?r=" + serverName + "&n=" + charName;
    }
    public static String ArmoryURL_TalentsInfo(WarcraftRegions wowRegion, String charName, String serverName) {
      return "http://" + ArmoryServer(wowRegion) + "/character-talents.xml?r=" + serverName + "&n=" + charName;
    }
    #endregion

    #region "Constant Values and Functions - Common Logic Decisions"
    public const String CLASS_DK = "deathknight";
    public const String CLASS_DRUID = "druid";
    public const String CLASS_HUNTER = "hunter";
    public const String CLASS_MAGE = "mage";
    public const String CLASS_PALADIN = "paladin";
    public const String CLASS_PRIEST = "priest";
    public const String CLASS_ROGUE = "rogue";
    public const String CLASS_SHAMAN = "shaman";
    public const String CLASS_WARRIOR = "warrior";
    public const String CLASS_WARLOCK = "warlock";


    public static bool ShowMeleeStats(String className, int specTree) {
      switch (className.ToLower().Trim()) {
        case CLASS_DRUID: if (specTree != 2) { return false; } break;
        case CLASS_PALADIN: if (specTree == 1) { return false; } break;
        case CLASS_SHAMAN: if (specTree != 2) { return false; } break;
        case CLASS_MAGE:
        case CLASS_PRIEST:
        case CLASS_WARLOCK: 
          return false;
      }
      return true;
    }
    public static bool ShowSpellStats(String className, int specTree) {
      switch (className.ToLower().Trim()) {
        case CLASS_DK: if (specTree != 1) { return false; }; break;
        case CLASS_DRUID: if (specTree == 2) { return false; } break;
        case CLASS_PALADIN: if (specTree != 1) { return false; } break;
        case CLASS_SHAMAN: if (specTree == 2) { return false; } break;
        case CLASS_HUNTER:
        case CLASS_ROGUE: 
        case CLASS_WARRIOR: 
          return false;
      }
      return true;
    }

    public static SpellTypes ShowSpellPowerIcon(String className, int specTree) {
      switch (className.ToLower().Trim()) {
        case CLASS_DK:
          if (specTree == 2) {
            return SpellTypes.Frost;
          } else {
            return SpellTypes.Shadow;
          } break;
        case CLASS_DRUID:
          if (specTree == 1) {
            return SpellTypes.Nature;
          } else {
            return SpellTypes.Healing;
          } break;
        case CLASS_MAGE:
          if (specTree == 1) {
            return SpellTypes.Arcane;
          } else if (specTree == 2) { 
            return SpellTypes.Fire;
          } else {
            return SpellTypes.Frost;
          } break;
        case CLASS_PALADIN: return SpellTypes.Holy;
        case CLASS_PRIEST:
          if (specTree == 3) {
            return SpellTypes.Shadow;
          } else {
            return SpellTypes.Healing;
          } break;
        case CLASS_SHAMAN:
          if (specTree == 3) {
            return SpellTypes.Healing;
          } else {
            return SpellTypes.Nature;
          } break;
        case CLASS_WARLOCK: return SpellTypes.Shadow;
      }
      return SpellTypes.Uninitialized;
    }

    #endregion
  }

  #region "Enumerations"
  public enum WarcraftRegions {
    RegionUnknown = 0,
    RegionUS = 1,
    RegionEurope = 2
  }

  public enum WarcraftStatTypes {
    Unknown = 0,
    Reputation = 1,
    Ability = 2,
    ProfessionSkill = 3,
    SecondarySkill = 4,
    CraftingSkill = 5,
    ArmorSkill = 6,
    WeaponSkill = 7,
    Languages = 8,
    Resistances = 9,
    DefenseSkill = 10,
    MeleeSkill = 11,
    RangedSkill = 12,
    SpellSkill = 13,
    GuildInfo = 14,
    ArenaTeamInfo = 15,
    BaseCharStats = 16
  }

  public enum WGR_LoadTypes {
    Unknown = 0,
    RosterLoad = 1,
    CharEntryLoad = 2
  }
  public enum WGR_LoadStatus {
    Uninitialized = -1,
    NewOrEmpty = 0,
    LoadedSuccessfully = 1,
    ReloadRequired = 2,
    LoadInProgress = 3
  }

  public enum SpellTypes {
    Uninitialized = -1,
    Arcane = 0,
    Fire = 1,
    Frost = 2,
    Healing = 3,
    Holy = 4,
    Nature = 5,
    Shadow = 6
  }

  #endregion

}
